<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            #box {
                height: 100px;
                background-color: red;
                display:inline-block;
            }
        </style>
    </head>
    <body>
        <div id="box" style="width: 100px;"></div>
        <script>
            function animationWidth() {
                var div = document.getElementById('box');
                div.style.width = parseInt(div.style.width) + 1 + 'px';
                if (parseInt(div.style.width) < 200) {
                    // requestAnimationFrame(animationWidth);
                    animationWidth()
                }
            }
            // requestAnimationFrame(animationWidth);
            animationWidth();
        </script>
    </body>
</html>
